<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>背景的固定和滚动</title>
    <style>
        .box{
            width: 300px;
            height: 3000px;
            background-color: yellow;
            background-image: url(img1/1.jpg);
            background-repeat: no-repeat;
            background-attachment:fixed ;
            margin: 0 auto;
        }
    </style>
</head>
<body>
    <div class="box">

    </div>
</body>
</html>